<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page
	import="org.springframework.security.core.AuthenticationException"%>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8" />
<style type="text/css">
.promoteZ {
	z-index: 20036 !important; /* Dialog z-index is 1006*/
}
</style>


<style type="text/css">
</style>
<title>Login</title>

<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/static/css/logreg-style.css />
<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/static/css/logreg-form.css />
<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/static/css/jquery-ui-1.8.14.custom.css />
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-1.6.2.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-1.6.2.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-ui-1.8.16.custom.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery.validate-1.5.5.min.js></script>

<script type="text/javascript">
	function submitForm() {

		jQuery("form").submit();

	}
	jQuery(document).ready(function() {
		
		jQuery("#editpersonForm").validate({
			rules : {
				name : {
					required : true

				},
				surname : {
					required : true

				},
				birthdate : {
					required : true
					
				},

				description : {
					required : true
				},

				nationality : {
					required : true
				}


			},
			messages : {
				name : {
					required : "Wymagane pole!"

				},
				surname : {
					required : "Wymagane pole!"

				},
				description : {
					required : "Wymagane pole!",
					rangelength : "Wprowadz date urodzenia w formacie yyyy",
					range : "Wprowadz poprawną date urodzenia!"

				},

				nationality : {
					required : "Wymagane pole!"
				},

				birthdate : {
					required : "Wymagane pole!"
				}
				
			},
			success : function(label) {
				label.html("&nbsp;").addClass("sprawdzony");
			},
			error : function(label) {
				alert("label");
			}

		});
		$( "#birthDate" ).datepicker({ minDate: "-100Y", maxDate: "-18Y",changeMonth: true,
			changeYear: true, showOn: 'focus'});
	});
	
	
</script>
<style type="text/css">
.promoteZ {
	z-index: 20036 !important; /* Dialog z-index is 1006*/
}

label {
	width: 200px !important;
	float: left;
	display: inline;
	clear: none;
}

label.error {
	margin: 0;
	margin-left: 10px !important;
	float: left;
	background: none;
	color: red;
	padding-left: 15px;
	vertical-align: top;
}

p {
	clear: both;
}

label.sprawdzony {
	float: left;
	background: url("../static/images/sprawdzony.png") no-repeat 0px 0px;
	margin-left: 5px;
}
</style>
</head>
<body>
	<div id="header">

		<form:form class="cmxform" commandName="editPersonForm" id="editPersonForm"
			method="post" action="adminAddPerson.do" style="width:700px;">
			<fieldset>
				<legend>Dodaj nowego aktora</legend>
				<p>
					<form:label path="name">Imie</form:label>
					<form:input path="name" required="required" />
				</p>
				<p>
					<form:label path="surname">Nazwisko</form:label>
					<form:input path="surname" required="required" />
				</p>
				<p>
					<form:label path="description">Opis</form:label>
					<form:input path="description" required="required"/>
				</p>
				<p>
					<form:label path="nationality">Narodowosc</form:label>
					<form:input path="nationality" required="required" />
				</p>
				<p>
				<form:label path="birthDate">Data urodzenia</form:label>
							<form:input path="birthDate" id="birthDate"
								required="required" />
				</p>
				<p>
					
					<label style="color: red;">${message}</label><input type="submit"
						value="Dodaj" />
		
			</fieldset>

		</form:form>
		
		
		<a href="adminListCars.do">Wroc</a>

	</div>

	<div id="masthead"
		style="background: url('../static/images/images1.jpg') no-repeat; height: 400px; margin: auto;">
	</div>

	<div id="footer">
		<p>i to wszystko na razie jesli chodzi o te strone :)</p>
	</div>
	</div>
</body>
</html>